package com.glela.goods.dao.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.github.pagehelper.PageHelper;
import com.glela.goods.dao.ShoppingCartDao;
import com.glela.goods.mapper.ProductMapper;
import com.glela.goods.mapper.ShoppingCartMapper;
import com.glela.goods.model.Product;
import com.glela.goods.model.ShoppingCart;
import com.glela.goods.model.vo.ShoppingCartVo;
import com.glela.goods.mapper.ProductMapper;
import com.glela.platform.model.request.RequestPageBaseModel;

/**
 *@author liujie
 *@2016年10月20日
 */
@Repository
public class ShoppingCartDaoImpl implements ShoppingCartDao{

	@Autowired
	private ShoppingCartMapper shoppingCartMapper;
	@Autowired
	private ProductMapper ProductMapper;
	@Override
	public int insert(ShoppingCart record) {
		// TODO Auto-generated method stub
		return shoppingCartMapper.insert(record);
	}
	
	@Override
	public int insertSelective(ShoppingCart record) {
		// TODO Auto-generated method stub
		return shoppingCartMapper.insertSelective(record);
	}
	@Override
	public int deleteByPrimaryKey(Integer id) {
		// TODO Auto-generated method stub
		return shoppingCartMapper.deleteByPrimaryKey(id);
	}
	@Override
	public int updateByPrimaryKeySelective(ShoppingCart record) {
		// TODO Auto-generated method stub
		return shoppingCartMapper.updateByPrimaryKeySelective(record);
	}
	@Override
	public List<ShoppingCartVo> selectMoreInfoByUserIdPage(RequestPageBaseModel requestPageBaseModel) {
		// TODO Auto-generated method stub
		PageHelper.startPage(requestPageBaseModel.getPageNum(), requestPageBaseModel.getPageSize());
		return shoppingCartMapper.selectMoreInfoByUserId(requestPageBaseModel.getUserId());
	}
	@Override
	public ShoppingCart selectByUserInventoryId(Long userId, Long inventoryId) {
		// TODO Auto-generated method stub
		return shoppingCartMapper.selectByUserInventoryId(userId, inventoryId);
	}


	


	public Product selectspecificationByProID(long proID){
		return ProductMapper.selectProductById(proID);
	}
	
	@Override
	public String selectIMGBydetailAndGoodID(int specificationDetailId,long goodId) {
		return ProductMapper.selectIMGBydetailAndGoodID(specificationDetailId,goodId);
	}

}
